Skip to content

FIX: Reuse the predefined offsetof instead of raising #error - #1050

Merged
jhpark816 merged 1 commit into
naver:developfrom
zhy2on:fix-make-error
Nov 16, 2026
Merged

jhpark816 merged 1 commit into
naver:developfrom
zhy2on:fix-make-error

Conversation

@zhy2on

@zhy2on zhy2on commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

⌨️ What I did

문제

최신 Ubuntu(24.04, glibc 2.39)에서 --enable-persistence 옵션으로 빌드하면, cmdlogrec.c를 컴파일하는 단계에서 아래와 같이 실패합니다.

engines/default/cmdlogrec.c:35:2: error: #error "offsetof is already defined"
...
/usr/lib/gcc/aarch64-linux-gnu/13/include/stddef.h:416: note: this is the location of the previous definition
  416 | #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)

CI는 --enable-persistence 없이 빌드하기 때문에 이 문제가 잡히지 않았고, 로컬에서 persistence를 켜고 테스트하다가 발견했습니다.


원인

cmdlogrec.c는 offsetof를 직접 정의해서 쓰는데, 이미 정의돼 있으면 #error로 빌드를 멈추도록 되어 있었습니다.
glibc 2.37부터 <sys/un.h>가 <stddef.h>를 include하면서 offsetof가 먼저 정의됩니다. (glibc c15318b)
cmdlogrec.c도 config_static.h를 거쳐 이 헤더를 include하기 때문에 #error에 걸립니다.


수정

이미 정의돼 있어도 에러를 내지 않도록 #ifdef + #error를 #ifndef로 바꿨습니다.

시스템 헤더에 정의된 offsetof와 기존에 직접 정의하던 offsetof는 내용이 같습니다.
그래서 어느 쪽 정의를 쓰더라도 동작은 바뀌지 않습니다.

@jhpark816
jhpark816 merged commit 6509a80 into naver:develop Nov 16, 2026
1 check passed
@zhy2on
zhy2on deleted the fix-make-error branch November 16, 2026 15:38
@namsic

namsic commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants